
basic = []

def create_basic_nums(count):
    if count < 0:
        print('count error')
        exit(0)

    for i in range(1, count + 1):
        num_str = str(i)
        if len(num_str) < 2:
            num_str = ' ' + num_str
        basic.append(num_str)

    print('the basic is {}'.format(basic))


create_basic_nums(int(input('input lines: ')))


# 打印上三角
def print_upper_triangular():
    print('begin print upper triangular ************************')
    lines = len(basic)

    for i in range(1, lines + 1):
        cur = ['  '] * lines
        for j in range(0, i):
            cur[- (j + 1)] = basic[j]
        result = ' '.join(cur)
        print(result)


print_upper_triangular()

# 打印下三角
def print_lower_triangular():
    print('begin print lower triangular ************************')
    lines = len(basic)

    lower_nums = basic[::-1]
    for i in range(0, lines):
        cur = ['  '] * lines
        for j in range(i, len(cur)):
            cur[j] = lower_nums[j]
        result = ' '.join(cur)
        print(result)


print_lower_triangular()
